/**
 * Copyright (c) 2000-2011 Liferay, Inc. All rights reserved.
 *
 * This library is free software; you can redistribute it and/or modify it under
 * the terms of the GNU Lesser General Public License as published by the Free
 * Software Foundation; either version 2.1 of the License, or (at your option)
 * any later version.
 *
 * This library is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
 * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
 * details.
 */

package com.college.model.impl;

import com.college.model.University;
import com.college.model.UniversityModel;
import com.college.model.UniversitySoap;

import com.liferay.portal.kernel.bean.AutoEscapeBeanHandler;
import com.liferay.portal.kernel.util.GetterUtil;
import com.liferay.portal.kernel.util.StringBundler;
import com.liferay.portal.kernel.util.StringPool;
import com.liferay.portal.model.impl.BaseModelImpl;
import com.liferay.portal.service.ServiceContext;

import com.liferay.portlet.expando.model.ExpandoBridge;
import com.liferay.portlet.expando.util.ExpandoBridgeFactoryUtil;

import java.io.Serializable;

import java.lang.reflect.Proxy;

import java.sql.Types;

import java.util.ArrayList;
import java.util.List;

/**
 * The base model implementation for the University service. Represents a row in the &quot;icampus_university&quot; database table, with each column mapped to a property of this class.
 *
 * <p>
 * This implementation and its corresponding interface {@link com.college.model.UniversityModel} exist only as a container for the default property accessors generated by ServiceBuilder. Helper methods and all application logic should be put in {@link UniversityImpl}.
 * </p>
 *
 * <p>
 * Never modify or reference this class directly. All methods that expect a university model instance should use the {@link com.college.model.University} interface instead.
 * </p>
 *
 * @author TransIT mPower Labs
 * @see UniversityImpl
 * @see com.college.model.University
 * @see com.college.model.UniversityModel
 * @generated
 */
public class UniversityModelImpl extends BaseModelImpl<University>
	implements UniversityModel {
	public static final String TABLE_NAME = "icampus_university";
	public static final Object[][] TABLE_COLUMNS = {
			{ "university_id", new Integer(Types.BIGINT) },
			{ "university_name", new Integer(Types.VARCHAR) }
		};
	public static final String TABLE_SQL_CREATE = "create table icampus_university (university_id LONG not null primary key,university_name VARCHAR(75) null)";
	public static final String TABLE_SQL_DROP = "drop table icampus_university";
	public static final String DATA_SOURCE = "liferayDataSource";
	public static final String SESSION_FACTORY = "liferaySessionFactory";
	public static final String TX_MANAGER = "liferayTransactionManager";
	public static final boolean ENTITY_CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.util.service.ServiceProps.get(
				"value.object.entity.cache.enabled.com.college.model.University"),
			true);
	public static final boolean FINDER_CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.util.service.ServiceProps.get(
				"value.object.finder.cache.enabled.com.college.model.University"),
			true);

	/**
	 * Converts the soap model instance into a normal model instance.
	 *
	 * @param soapModel the soap model instance to convert
	 * @return the normal model instance
	 */
	public static University toModel(UniversitySoap soapModel) {
		University model = new UniversityImpl();

		model.setUniversityId(soapModel.getUniversityId());
		model.setUniversityName(soapModel.getUniversityName());

		return model;
	}

	/**
	 * Converts the soap model instances into normal model instances.
	 *
	 * @param soapModels the soap model instances to convert
	 * @return the normal model instances
	 */
	public static List<University> toModels(UniversitySoap[] soapModels) {
		List<University> models = new ArrayList<University>(soapModels.length);

		for (UniversitySoap soapModel : soapModels) {
			models.add(toModel(soapModel));
		}

		return models;
	}

	public static final long LOCK_EXPIRATION_TIME = GetterUtil.getLong(com.liferay.util.service.ServiceProps.get(
				"lock.expiration.time.com.college.model.University"));

	public UniversityModelImpl() {
	}

	public long getPrimaryKey() {
		return _universityId;
	}

	public void setPrimaryKey(long pk) {
		setUniversityId(pk);
	}

	public Serializable getPrimaryKeyObj() {
		return new Long(_universityId);
	}

	public long getUniversityId() {
		return _universityId;
	}

	public void setUniversityId(long universityId) {
		_universityId = universityId;
	}

	public String getUniversityName() {
		if (_universityName == null) {
			return StringPool.BLANK;
		}
		else {
			return _universityName;
		}
	}

	public void setUniversityName(String universityName) {
		_universityName = universityName;
	}

	public University toEscapedModel() {
		if (isEscapedModel()) {
			return (University)this;
		}
		else {
			return (University)Proxy.newProxyInstance(University.class.getClassLoader(),
				new Class[] { University.class },
				new AutoEscapeBeanHandler(this));
		}
	}

	public ExpandoBridge getExpandoBridge() {
		if (_expandoBridge == null) {
			_expandoBridge = ExpandoBridgeFactoryUtil.getExpandoBridge(0,
					University.class.getName(), getPrimaryKey());
		}

		return _expandoBridge;
	}

	public void setExpandoBridgeAttributes(ServiceContext serviceContext) {
		getExpandoBridge().setAttributes(serviceContext);
	}

	public Object clone() {
		UniversityImpl universityImpl = new UniversityImpl();

		universityImpl.setUniversityId(getUniversityId());

		universityImpl.setUniversityName(getUniversityName());

		return universityImpl;
	}

	public int compareTo(University university) {
		long pk = university.getPrimaryKey();

		if (getPrimaryKey() < pk) {
			return -1;
		}
		else if (getPrimaryKey() > pk) {
			return 1;
		}
		else {
			return 0;
		}
	}

	public boolean equals(Object obj) {
		if (obj == null) {
			return false;
		}

		University university = null;

		try {
			university = (University)obj;
		}
		catch (ClassCastException cce) {
			return false;
		}

		long pk = university.getPrimaryKey();

		if (getPrimaryKey() == pk) {
			return true;
		}
		else {
			return false;
		}
	}

	public int hashCode() {
		return (int)getPrimaryKey();
	}

	public String toString() {
		StringBundler sb = new StringBundler(5);

		sb.append("{universityId=");
		sb.append(getUniversityId());
		sb.append(", universityName=");
		sb.append(getUniversityName());
		sb.append("}");

		return sb.toString();
	}

	public String toXmlString() {
		StringBundler sb = new StringBundler(10);

		sb.append("<model><model-name>");
		sb.append("com.college.model.University");
		sb.append("</model-name>");

		sb.append(
			"<column><column-name>universityId</column-name><column-value><![CDATA[");
		sb.append(getUniversityId());
		sb.append("]]></column-value></column>");
		sb.append(
			"<column><column-name>universityName</column-name><column-value><![CDATA[");
		sb.append(getUniversityName());
		sb.append("]]></column-value></column>");

		sb.append("</model>");

		return sb.toString();
	}

	private long _universityId;
	private String _universityName;
	private transient ExpandoBridge _expandoBridge;
}